package com.redpack.redpost.connection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class RedpostConexion {
	
    public static Connection openConnection() throws SQLException {

        String url = "jdbc:postgresql://localhost:5432/redpostrp"; //LOCALHOST
		Connection conn = null;

		try{
			Class.forName("org.postgresql.Driver" ) ;
//			conn = DriverManager.getConnection(url,"postgres","123");
			conn = DriverManager.getConnection(url,"postgres","codice");
			return conn;
		}catch(Exception e){
			e.printStackTrace();
		}		
		return conn;
	}
    
    public static void closeConnection(Connection conn) throws SQLException {
		conn.close();
	}
    
    private RedpostConexion( )
    {
        
    }

}
